package cn.kgc.Thread.work.work02;

public class ClimbThread extends Thread {
    private int time;
    private int num;

   public ClimbThread(String name, int time,int kio){
       super(name);
       this.time = time;
       this.num=kio*1000/100;
   }
   public void run(){
       while (num>0){
           try {
               Thread.sleep(this.time);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
           System.out.println(Thread.currentThread().getName()+"爬完100米！");
           num--;
       }
       System.out.println(Thread.currentThread().getName()+"到达终点！");
   }

    public static void main(String[] args) {
        ClimbThread oldPeople=new ClimbThread("老年人",1000,1);
        ClimbThread youngPeople=new ClimbThread("年轻人",500,1);
        System.out.println("********开始爬山********");
        oldPeople.start();
        youngPeople.start();

    }
}
